package com.central.scheduler.remote.command;

import com.central.scheduler.common.utils.JSONUtils;

import java.io.Serializable;

/**
 * @author Tindy
 * @date 2021/10/29
 * @describe
 *  kill task request command
 */
public class TaskKillRequestCommand implements Serializable {

    /**
     *  task id
     */
    private long taskInstanceId;

    public long getTaskInstanceId() {
        return taskInstanceId;
    }

    public void setTaskInstanceId(long taskInstanceId) {
        this.taskInstanceId = taskInstanceId;
    }

    /**
     *  package request command
     *
     * @return command
     */
    public Command convert2Command() {
        Command command = new Command();
        command.setType(CommandType.TASK_KILL_REQUEST);
        byte[] body = JSONUtils.toJsonByteArray(this);
        command.setBody(body);
        return command;
    }

    @Override
    public String toString() {
        return "TaskKillRequestCommand{"
                + "taskInstanceId=" + taskInstanceId
                + '}';
    }
}
